﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TheSnake
{
    class MovingObsticle : MovingObject, IMovable
    {
        public const char Symbol = 'E';
        public new const string CollisionGroupString = "obsticle";

        public MovingObsticle(MatrixCoords topLeft, MatrixCoords speed)
            : base(topLeft, new char[,] { { Symbol } }, speed) 
        {
            this.Speed = speed;
        }
      
        public void MoveUp()
        {
            if (this.Speed.Row != 1)
            {
                this.Speed = new MatrixCoords(-1, 0);
                this.UpdateSpeed(this.Speed);
            }
        }

        public override void UpdatePosition()
        {
            this.TopLeft += this.Speed;
        }

        public override void Update()
        {
            this.UpdatePosition();
        }

        public void UpdateSpeed(MatrixCoords meSpeed)
        {
            this.Speed = meSpeed;
        }

        public override string GetCollisionGroupString()
        {
            return MovingObsticle.CollisionGroupString;
        }
    }
}
